/*
 * Copyright (c) 2008 by 1eEurope (Switzerland) AG, Thalwil
 *
 * Customer:	1eEurope (Switzerland) AG
 * Project:		BKS
 * Created:		30.09.2008, WBL
 *
*/

using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using Microsoft.SharePoint.Publishing;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint;
using System.Collections.Specialized;
using System.Xml;
using System.IO;
using System.Xml.Xsl;
using System.Web.UI.WebControls;
using By1eEurope.BKS.Tools.Utils;

namespace By1eEurope.BKS.Controls
{
    /// <summary>
    /// Renders the ClientId of a ASP.Net control referenced by ServerId
    /// </summary>
    public class ClientId : WebControl
    {
        private string controlId;
        /// <summary>
        /// ServerId of the control whose ClientId shoult be rendered
        /// </summary>
        public string ControlId
        {
            set { this.controlId = value; }
        }

        protected override void Render(HtmlTextWriter writer)
        {
            try
            {
                Control c = this.FindControl(this.controlId);
                if (c != null)
                    writer.Write(c.ClientID);
            }
            catch (Exception) { }
        }
    }
}
